`ifndef {{NAME}}_AGENT__SV
`define {{NAME}}_AGENT__SV

class {{name}}_agent extends uvm_agent;
    {{name}}_driver drv;
    {{name}}_monitor mon;
    {{name}}_sequencer sqr;

    uvm_analysis_port #({{name}}_transaction) ap;

    function new(string name, uvm_component parent);
        super.new(name, parent);
    endfunction

    extern virtual function void build_phase(uvm_phase phase);
    extern virtual function void connect_phase(uvm_phase phase);

    `uvm_component_utils({{name}}_agent);
endclass

function void {{name}}_agent::build_phase(uvm_phase phase);
    super.build_phase(phase);
    if (is_active == UVM_ACTIVE) begin
        sqr = {{name}}_sequencer::type_id::create("sqr", this);
        drv = {{name}}_driver::type_id::create("drv", this);
    end

    mon = {{name}}_monitor::type_id::create("mon", this);
endfunction

function void {{name}}_agent::connect_phase(uvm_phase phase);
    super.connect_phase(phase);
    if (is_active == UVM_ACTIVE) begin
        drv.seq_item_port.connect(sqr.seq_item_export);
    end
    ap = mon.ap;
endfunction

`endif